package com.roc.web.action.windcontroll;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class WhiteListSearchCondition extends BaseSearchCondition {
	private String mchtId;
	private String mchtName;
	private String status;
	private String date;
	private String accountNo;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(mchtId))
		{
			filedBeanList.add(new WhereHQLFieldBean("S.WHILTE_NUM", mchtId,"=", false));
		}
		if(Constance.isNotEmpty(mchtName))
		{
			filedBeanList.add(new WhereHQLFieldBean("S.WHILTE_NAME", mchtName,"LIKE", false,"ALL"));
		}
		if(Constance.isNotEmpty(status))
		{
			filedBeanList.add(new WhereHQLFieldBean("S.WHILTE_USE", status,"=", false));
		}
		if(Constance.isNotEmpty(date))
		{
			filedBeanList.add(new WhereHQLFieldBean("S.WHILTE_INFO", date,"LIKE", false,"ALL"));
		}
		if(Constance.isNotEmpty(accountNo))
		{
			filedBeanList.add(new WhereHQLFieldBean("S.WHILTE_INFO", accountNo,"LIKE", false,"ALL"));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT COUNT(1) FROM APSTFR.TBL_POS_WHILTE_LIST S WHERE 1=1 AND S.WHILTE_TYPE='mcht' ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT S.WHILTE_NUM,S.WHILTE_NAME,S.WHILTE_USE,S.WHILTE_INFO FROM APSTFR.TBL_POS_WHILTE_LIST S WHERE 1=1 AND S.WHILTE_TYPE='mcht' ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return " ORDER BY S.WHILTE_NUM ";
	}

	public String getMchtId() {
		return mchtId;
	}

	public void setMchtId(String mchtId) {
		this.mchtId = mchtId;
	}

	public String getMchtName() {
		return mchtName;
	}

	public void setMchtName(String mchtName) {
		this.mchtName = mchtName;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}
	
}
